#!/usr/bin/python
sum = 0;
fib1 = 0;
fib2 = 0;
fibRes = 0
for i in range(1,4000000):
	if i == 1:
		fib1 = 1;
		fibRes = 1;
		#print i;
	elif i == 2:
		fib2 = 2;
		fibRes = 2
		sum += fibRes
		#print i;
	else:
		fibRes = fib1 + fib2;
		fib1 = fib2;
		fib2 = fibRes;
		#print "fib1 is: ", fib1, "fib2 is", fib2, "result is", fibRes;
		if fibRes % 2 == 0:
			sum += fibRes;
	#print fibRes;
	if fibRes > 4000000:
		break;
print sum;

#print sum;
